package com.example.data.permission.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.example.data.permission.entity.BsdAccount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.data.permission.entity.User;
import com.example.data.permission.mp.permission.DataPermission;
import com.example.data.permission.mp.permission.DataPermissionType;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 结算账户表 Mapper 接口
 * </p>
 *
 * @author demo
 * @since 2021-07-22
 */
public interface BsdAccountMapper extends BaseMapper<BsdAccount> {

    //
    @Override
   @DataPermission(type = DataPermissionType.OWN_SHOP_CHILD)
    List<BsdAccount> selectList(@Param("ew") Wrapper<BsdAccount> queryWrapper);

    // 自定义数据权限: mrguo用户，数据库查询权限，只能查询某些字段和自己自己创建的数据
    @DataPermission(type = DataPermissionType.SYS_CUSTOM,code = "test001",selectItems = "account,shop_id,id,name,status")
    List<BsdAccount> selectAccountsByUser(@Param("user")User user,String name);

    // 自定义数据权限: mrguo用户 只能查看2021年之后的数据
    @DataPermission(type = DataPermissionType.SYS_CUSTOM,code = "test002")
    List<BsdAccount> selectAccounts();
}
